import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'

import Login from '../views/login'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true,
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/features/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/features/401'], resolve),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: (resolve) => require(['@/views/features/redirect'], resolve)
      }
    ]
  },
  {
    path: '/',
    component: () => import('@/views/website/home'),
    redirect: '/hj-home/home',
    // children: [
    //   {
    //     path: 'dashboard',
    //     component: (resolve) => require(['@/views/home'], resolve),
    //     name: 'Dashboard',
    //     meta: { title: '首页', icon: 'index', affix: true, noCache: true }
    //   }
    // ]
  },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'center',
        component: (resolve) => require(['@/views/system/user/center'], resolve),
        name: '个人中心',
        meta: { title: '个人中心' }
      }
    ]
  },
  {
    path: '/hj-home/register',
    component: () => import('@/views/register/index'),
    hidden: true
  },
  {
    path: '/hj-home/reset-password',
    component: () => import('@/views/website/reset-password/index'),
    hidden: true,
    meta: {
      permission: true
    }
  },
  {
    path: '/hj-home',
    component: () => import('@/views/index'),
    hidden: true,
    redirect: '/hj-home/home',
    children: [
      {
        path: 'index',
        name: 'index',
        component: () => import('@/views/website/index/index'),
        meta: {
          title: '系统',
          tagName: 'index'
        }
      },
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/website/home/index'),
        meta: {
          title: '首页',
          tagName: 'home',
        }
      },
      {
        path: 'home-info',
        name: 'home-info',
        component: () => import('@/views/website/home-info/index'),
        meta: {
          title: '详情',
          tagName: 'home-info',
        }
      },
      {
      	path: 'intro',
      	name: 'intro',
      	component: () => import('@/views/website/intro/index'),
      	meta: {
      		title: '中心简介',
      		tagName: 'intro',
      		permission: true
      	}
      },
      {
      	path: 'notes',
      	name: 'notes',
      	component: () => import('@/views/website/notes/index'),
      	meta: {
      		title: '通知公告',
      		tagName: 'notes',
      		permission: true

      	}
      },
      {
      	path: 'notes/detail/:id',
      	name: 'notesDetail',
      	component: () => import('@/views/website/notes/detail'),
      	meta: {
      		title: '公告详情',
      		tagName: 'notes',
      		activeMenu: '/notes',
      		preName: '通知公告',
      		permission: true
      	}
      },
      {
      	path: 'news',
      	name: 'news',
      	component: () => import('@/views/website/news/index'),
      	meta: {
      		title: '新闻动态',
      		tagName: 'news',
      		permission: true
      	}
      },
      {
      	path: 'news/detail/:id',
      	name: 'newsDetail',
      	component: () => import('@/views/website/news/detail'),
      	meta: {
      		title: '新闻详情',
      		tagName: 'news',
      		activeMenu: '/news',
      		preName: '新闻动态',
      		permission: true
      	}
      },
      {
      	path: 'hcsmng',
      	name: 'hcsmng',
      	component: () => import('@/views/website/hcsmng/index'),
      	meta: {
      		title: '规章制度',
      		tagName: 'hcsmng',
      		permission: true
      	}
      },
      {
      	path: 'hcsmng/detail/:id',
      	name: 'hcsmngDetail',
      	component: () => import('@/views/website/hcsmng/detail'),
      	meta: {
      		title: '规章制度详情',
      		tagName: 'hcsmng',
      		activeMenu: '/hcsmng',
      		preName: '规章制度',
      		permission: true
      	}
      },
      {
        path: '/hj-user',
        component: () => import('@/views/website/user'),
        name: 'hj-user',
        hidden: true
      },
      {
        path: 'search-list',
        component: () => import('@/views/website/searchList'),
        name: 'search-list',
      }
    ]
  }
]

export default new Router({
  // mode: 'hash',
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
